<template>
	<div style="width: 100%;height: 100%;">
		<HomeNotice :myData="noticeSwiperSlides"></HomeNotice>
	</div>
</template>

<script>
	import HomeNotice from "../../../real-components/HomeNotice/noticeDetail";
	import { mapGetters } from "vuex";
	import { getPageTree, initDomTree } from "../../../utils/getPageTree";
	import axios from "axios";
	export default {
		name: 'hello',
		data() {
			return {
				msg: '这是首页',
				page: "home",
				componentName: "HomeNotice",
				noticeSwiperSlides: [],
			}
		},
		computed: {
			...mapGetters([
				"getDomTree"
			]),
			pageTree() {
				return getPageTree(this, this.page);
			}
		},
		components: {
			HomeNotice,
		},
		methods: {
//			queryNotice() {
//				axios.get(api.local_host + '/bulletin/qryBulletinListFromH5?status=1&enterpriseid=' + api.enterpriseId).then((res) => {
//					let data = res.data.data[0];
//					console.log(data,'data');
//					/*this.noticeSwiperSlides = data*/
//
//					let rid = this.$route.query.rid;
//					console.log(rid);
//					for(var i=0;i<data.length;i++){
//						if(rid == data[i].rid){
//							var arr = [];
//							arr.push(data[i]);
//							this.noticeSwiperSlides = arr;
//							console.log(this.noticeSwiperSlides,'父组件');
//						}
//					}
//				   
//				})
//			},
			queryNotice() {
				let config = {
					url:window.api.customer_host+'/bulletinVue/qryBulletinListFromH5',
					method:'POST',
					data:{"isPage":"false","enterpriseCode": window.api.enterpriseCode,"storeId":localStorage.getItem('shopId')}
				}
				axios(config).then((res) => {
					let data = res.data.data[0].results;
					console.log(data,'data');
					/*this.noticeSwiperSlides = data*/

					let rid = this.$route.query.rid;
					console.log(rid);
					for(var i=0;i<data.length;i++){
						if(rid == data[i].rid){
							var arr = [];
							arr.push(data[i]);
							this.noticeSwiperSlides = arr;
							console.log(this.noticeSwiperSlides,'父组件');
						}
					}
				   
				})
			}
			
		},
		created() {

		},
		mounted() {
			this.queryNotice()
			// initDomTree(this.getDomTree[this.page]);

		},
		updated() {
			//页面更新完毕
			// initDomTree(this.getDomTree[this.page]);
		}
	}
</script>

<style>
	.content {
	    width: 100%;
	    height: 100%;
	    display: flex;
	    flex-direction: column;
	    justify-content: space-between;
	}
</style>